package com.ssau.expert.entity;

/**
 * Author: Sergey Saiyan
 * Created: 05.09.13 13:29
 */
public enum ShipProfile {
    OCEANOLOGY("Океанология", 1),
    HYDRO_BIOLOGY("Гидробиология", 2),
    SEA_BIOLOGY("Биология моря", 3);

    String name;
    int id;

    ShipProfile(String name, int id) {
        this.name = name;
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public int getId() {
        return id;
    }

    public static ShipProfile fromLocal(String name) {
        for (ShipProfile profile : ShipProfile.values()) {
            if (profile.name.equals(name)) {
                return profile;
            }
        }
        return null;
    }

    public static ShipProfile fromId(int id) {
        for (ShipProfile profile : ShipProfile.values()) {
            if (profile.id == id) {
                return profile;
            }
        }
        return null;
    }
}
